<?php 
require_once('./system/classes/phpmailer/class.phpmailer.php');

function sendEmail($to, $from, $from_name = null, $replyto, $subject, $message)
{
	$mail = new PHPMailer();

	$mail->IsSMTP();                // send via SMTP
	$mail->SMTPDebug  = 0;  		//use 2 for full on report
	$mail->Host     = SMTP_HOST; 		// SMTP servers
	$mail->SMTPSecure = "ssl";          // sets the prefix to the server
	$mail->SMTPAuth = true;     		// turn on SMTP authentication
	$mail->Username = SMTP_USERNAME; // SMTP username
	$mail->Password = SMTP_PASSWORD; // SMTP password
	$mail->Port = SMTP_PORT; // SMTP port

	$mail->From     = $from;
	$mail->FromName = $from;
	$mail->AddAddress($to);
	$mail->AddReplyTo($replyto);
	$mail->IsHTML(true);    	// send as HTML

	$mail->Subject  =  $subject;
	$mail->Body     =  $message;

	$mail->SetLanguage("en", './system/classes/phpmailer/language/');
	if($mail->Send()) {
		return true;
	} else {
		echo "Mailer Error: " . $mail->ErrorInfo;
		return false;
	}
}
?>